<template>
	<div class="yd-report">
		<!-- <basic-container> -->
		<el-scrollbar class="main">
			<iframe id="iframe" :src="src" class="iframe" />
		</el-scrollbar>
		<!-- </basic-container> -->
	</div>
</template>

<script setup>
import { computed, onMounted } from 'vue';
import axios from '@/utils/request';
import useUserStore from '@/store/modules/userinfo';
const userStore = useUserStore();
const accessToken = userStore.access_token;
const serviceHostUrl = import.meta.env.VITE_APP_REPORT_HOST;

const src = computed(() => {
	return `${serviceHostUrl}/jimu/jmreport/list?token=${accessToken}`;
});

// iframe.src = `${serviceHostUrl}/jimu/jmreport/list?token=${accessToken}`;

// axios({
// 	method: 'get',
// 	url: `/jimu/jmreport/list?token=${accessToken}`,
// 	headers: {
// 		VERSION: 'lsz',
// 		responseType: 'document',
// 	},
// }).then((res) => {
// 	console.log(res);
// 	// console.log('---------------', res.documentElement);
// 	// let
// 	let iframe = document.getElementById('iframe');
// 	// const iframe = document.createElement('iframe');
// 	// document.body.appendChild(iframe);
// 	// iframe.src = 'data:text/html;charset=utf-8,' + escape(res);
// 	iframe.innerHTML = res;
// 	console.log(222);
// 	// iframe.onload = function () {
// 	console.log('onload----------');
// 	// iframe.contentDocument.documentElement.replaceWith(res);
// 	// iframe.contentWindow.document.body.innerHTML = res;
// 	// };
// });
</script>

<style lang="scss" scoped>
.iframe {
	width: 100%;
	height: 100vh; /*设置高度百分比,一直调到只有一个滚动调为止*/
	border: 0;
	overflow: hidden;
	box-sizing: border-box;
	padding: 20px;
}
:deep(.app-main) {
	padding: 0 !important;
}
.yd-report {
	background-color: #fff;
}
</style>
